package com.lyl.dangdang.mapper;

import com.lyl.dangdang.pojo.po.Item;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author liyunlong
 * @since 2024-06-08
 */
@Mapper
public interface ItemMapper extends BaseMapper<Item> {


    Item selectByBookIdAndUserId(@Param("bookId") Integer bookId, @Param("currentUser") Integer currentUser);

    int decreaseCountByBookIdAndUserId(Integer bookId, Integer currentUser);

    Item findByBookIdAndUserId(Integer bookId, Integer currentUser);

    void deleteByBookIdAndUserId(Integer userId, Integer bookId);

    void increaseCountByBookIdAndUserId(Integer bookId, Integer currentUser);


    int getUserCartSum(Integer currentUser);
}
